package com.hqyj.freemovie.front.repository;

import com.hqyj.freemovie.front.view.Students;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

public interface StudentsRepository extends ElasticsearchRepository<Students,String> {

    //对学生索引根据关键字进行全文检索
    @Query("{ \"bool\":{ \"must\":[ { \"multi_match\": { \"query\": \"?0\", \"type\": \"most_fields\", \"fields\": [ \"name\", \"sid\" ] } } ] } } ")
    Page<Students> elasticsearchMoviesByKeyWords(String keyword, Pageable pageable);
}
